TYPENAME

The TYPENAME function retrieves a variable’s IDL type name, class name, or structure name.

Examples

For the undefined variable foo, the following IDL statement:

PRINT, TYPENAME(foo)

produces the output:

UNDEFINED

 

For the variable a = 1.0, the following IDL statement:

PRINT, TYPENAME(a)

produces the output:

FLOAT

 

For the variable list = LIST(1,2,3), the following IDL statement:

PRINT, TYPENAME(list)

produces the output:

LIST

 

For the variable struct = {MYSTRUCT, field1: 'hi'}, the following IDL statement:

PRINT, TYPENAME(struct)

produces the output:

MYSTRUCT

 

For the variable obj = OBJ_NEW('IDLgrModel'), the following IDL statement:

PRINT, TYPENAME(obj)

produces the output:

IDLGRMODEL

Syntax

Result = TYPENAME(Variable)

Return Value

Returns a string containing the IDL type name, or an empty string if Variable is undefined. For objects, the class name is returned. For structures, the structure name (or “ANONYMOUS” if the variable is an anonymous structure) is returned.

Note: If Variable is a scalar object or a one-element object array, Result will be the object class name. If Variable is an object array with two or more elements, Result will be the IDL basic type name “OBJECT”. Structure arrays do not have this restriction because every element in a structure array must be of the same structure type, and Result will always be the structure name.

Arguments

Variable

An IDL variable or expression.

Version History

8.0

Introduced

See Also

ISA, SIZE , IDL Data Types